/*
    SUSAN® - Sole of Unix Save ANything

   
   Copyright (C) 2011-2016 Skyatlas Co. LTD
   

   
*/

#include "include/susan.h"
#include "cats/sql_pooling.h"
#include "dird/dird_conf.h"
#include "dird/get_database_connection.h"
#include "dird/jcr_private.h"
#include "include/jcr.h"

namespace directordaemon {

SusanDb* GetDatabaseConnection(JobControlRecord* jcr)
{
  return DbSqlGetPooledConnection(
      jcr, jcr->impl->res.catalog->db_driver, jcr->impl->res.catalog->db_name,
      jcr->impl->res.catalog->db_user,
      jcr->impl->res.catalog->db_password.value,
      jcr->impl->res.catalog->db_address, jcr->impl->res.catalog->db_port,
      jcr->impl->res.catalog->db_socket,
      jcr->impl->res.catalog->mult_db_connections,
      jcr->impl->res.catalog->disable_batch_insert,
      jcr->impl->res.catalog->try_reconnect,
      jcr->impl->res.catalog->exit_on_fatal);
}

}  // namespace directordaemon
